import json

class Settings:
    def __init__(self):
        self.platformName = None
        self.platformId = None
        self.name = None
        self.code = None
        self.host = None
        self.list = None
        self.vm1_server = None
        self.vm2_server = None

    def init(self, code="test", host="platform.wechain360.com"):
        with open('config.json', 'r', encoding='utf-8') as f:
            config_json = json.load(f)
            self.code = config_json.get('code', code)
            self.host = config_json.get('host', host)
            self.platformId = config_json.get('platformId', 0)
            self.platformName = config_json.get('platformName', "test")
            self.type = config_json.get('type', "temperature")
            self.list = config_json.get('list', [])
            self.vm1_server = config_json.get('vm1_server', None)
            self.vm2_server = config_json.get('vm2_server', None)


settings = Settings()

if __name__ == '__main__':
    settings.init()
    print(settings)
